﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GenericLibrary.Common
{
    public abstract class Index<TKey>
    {
        private TKey _currentKey;

        protected abstract void PreLocate();
        protected abstract void PostLocate();

        public TKey CurrentKey
        {
            get
            {
                return this._currentKey;
            }
        }

        public void Locate(TKey key)
        {
            this.PreLocate();
            this._currentKey = key;
            this.PostLocate();
        }

        protected Index(TKey initialKey)
        {
            this._currentKey = initialKey;
        }
    }

    public interface IIndexable
    {
        Index<TKey> CreateIndex<TKey>();
        bool IsSameLocation<TKey1, Tkey2>(Index<TKey1> index1, Index<Tkey2> index2);
    }
}
